<template>
  <h4>setup测试用子组件(打开调试窗口可以查看日志消息)</h4>
  <div>
    <span>来自父组件的数据: </span>
    <span>{{msg}}, </span>
    <span>{{course}}, </span>
    <span>{{$attrs.other}}</span>
  </div>
  <slot></slot>
  <slot name="second"></slot>
  <button class="testevent" @click="testEmit">测试自定义事件</button>
</template>

<script>
export default {
  name: 'SetupChild',
  props: ['msg', 'course'],
  setup(props, context) {
    console.log('props=', props)
    console.log('context=', context)

    function testEmit() {
      context.emit('testevent', 8888)
    }

    return {testEmit}
  },
}
</script>

<style scoped>

.testevent {
  margin-top: 10px;
}

</style>